import 'package:flutter/material.dart';
import 'package:sports_new/resources/colours.dart';
import 'package:sports_new/resources/get_icon.dart';
import 'package:sports_new/widgets/circular.dart';

class CheckWidget extends StatefulWidget {
  const CheckWidget({super.key, required this.value, this.onChanged, required this.size});

  final bool value;
  final double size;
  final ValueChanged<bool>? onChanged;

  @override
  State<CheckWidget> createState() => _CheckWidgetState();
}

class _CheckWidgetState extends State<CheckWidget> {
  bool get value => widget.value;
  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: (){
        widget.onChanged?.call(!value);
      },
      child: Container(
        width: widget.size,height: widget.size,
        decoration: BoxDecoration(
          shape: BoxShape.circle,
          color: value?Colours.main:null,
          border: value?null:Border.all(color: Colours.grey99,width: 0.5)
        ),
        child: Icon(
          GetIcon.check,color: value?Colours.white:Colours.transparent,
          size: widget.size
        ),
      ),
    );
  }
}